package com.xl.singletonPattern;

/**
 * 饿汉式单例模式
 */
public class EagerSingleton {
    //类加载时就创建实例
    private static final EagerSingleton instance = new EagerSingleton();
    private EagerSingleton() {
        System.out.println("创建实例...");
    }
    public static EagerSingleton getInstance() {
        return instance;
    }
}
